#include "bytetoint.h"

qint32 byteToInt32(QByteArray data) {
	qint32 result;
	int typeSize = sizeof(qint32);

	char * c = (char *) &result;

	for(int i = 0; i < typeSize; i++) c[i] = data[i];

	return result;
}

quint32 byteToUInt32(QByteArray data) {
	quint32 result;
	int typeSize = sizeof(quint32);

	char * c = (char *) &result;

	for(int i = 0; i < typeSize; i++) c[i] = data[i];

	return result;
}

qint16 byteToInt16(QByteArray data) {
	qint16 result;
	int typeSize = sizeof(qint16);

	char * c = (char *) &result;

	for(int i = 0; i < typeSize; i++) c[i] = data[i];

	return result;
}

quint16 byteToUInt16(QByteArray data) {
	quint16 result;
	int typeSize = sizeof(quint16);

	char * c = (char *) &result;

	for(int i = 0; i < typeSize; i++) c[i] = data[i];

	return result;
}

